package fr.isima.myanttest;

import static org.junit.Assert.fail;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import fr.isima.myant.Project;

public class MkdirTest {
	Project p;
	
	@Before
	public void beforeExecute() {
		try{
			p = new Project("testMkdir.txt");
		} catch(Exception e) {
			fail(e.getMessage());
		}
	}
	
	@Test
	public void testExecute() {
		p.execute("testmkdir");
		
		Path path = Paths.get("testdir");
		if (!Files.exists(path)) {
			fail("directory not found.");
		}		
	}
	
	@After
	public void after() {
		Path path = Paths.get("testdir");
		try {
			Files.delete(path);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
